package cn.com.dhcc.ddi.datamapping.vo;

import java.util.Date;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;

import cn.com.dhcc.app.core.annotation.SiColumn;
import cn.com.dhcc.app.core.annotation.SiTable;
import cn.com.dhcc.app.core.base.ModuleFeatureBean;
import cn.com.dhcc.ddi.task.service.transform.FuncHandlerInterface;
import cn.com.dhcc.ddi.task.service.transform.impl.CustomFuncHandler;
import cn.com.dhcc.ddi.task.service.transform.impl.DefFuncHandler;

/**
 * 函数表
 * @日期：2016/12/1 15:27
 * @作者：张洪涛
 * @版权所有：东华软件
 * @版本：1.0
 */
@SiTable(name = "t_ddi_fx_identify")
public class FuncIdentify extends ModuleFeatureBean{
    @SiColumn(isId = true)
    private String id;
    @SiColumn(name = "fx_name_en")
    private String fxNameEn;//函数英文名
    @SiColumn(name = "fx_name_cn")
    private String fxNameCn;//函数中文名
    @SiColumn(name = "fx_desc")
    private String fxDesc;//函数说明文字：包括，功能作用、操作过程、应用场景
    @SiColumn(name = "arg_content")
    private String argContent;//参数顺序号、类型、中文名、英文名、参数说明、是否为空、默认值、界面验证选项、验证提示字符串
    @SiColumn(name = "return_type")
    private String returnType;//返回值类型
    @SiColumn(name = "fx_type")
    private String fxType;//函数类型：1字符串操作、2日期操作、3数值操作、4类型转换操作
    private String isCustomized;//是否自定义函数 0 否 1 是
    private String iscommon;//是否为普通函数，非普通函数需做特殊处理 0否 1是
    private Date mtime;//最后修改时间
    private String remark;//备注

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getFxNameEn() {
        return fxNameEn;
    }

    public void setFxNameEn(String fxNameEn) {
        this.fxNameEn = fxNameEn;
    }

    public String getFxNameCn() {
        return fxNameCn;
    }

    public void setFxNameCn(String fxNameCn) {
        this.fxNameCn = fxNameCn;
    }

    public String getFxDesc() {
        return fxDesc;
    }

    public void setFxDesc(String fxDesc) {
        this.fxDesc = fxDesc;
    }

    public String getArgContent() {
        return argContent;
    }

    public void setArgContent(String argContent) {
        this.argContent = argContent;
    }

    public String getReturnType() {
        return returnType;
    }

    public void setReturnType(String returnType) {
        this.returnType = returnType;
    }

    public String getFxType() {
        return fxType;
    }

    public void setFxType(String fxType) {
        this.fxType = fxType;
    }

    public String getIsCustomized() {
        return isCustomized;
    }

    public void setIsCustomized(String isCustomized) {
        this.isCustomized = isCustomized;
    }

    public Date getMtime() {
        return mtime;
    }

    public void setMtime(Date mtime) {
        this.mtime = mtime;
    }
    
    public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getIscommon() {
		return iscommon;
	}

	public void setIscommon(String iscommon) {
		this.iscommon = iscommon;
	}


	//函数类型， 0 默认函数  1 自定义函数
    public enum FUNC_TYPE{
        DEF("0", DefFuncHandler.class),
        CUSTOMIZED("1", CustomFuncHandler.class);

        private String code;//类型
        private Class<? extends FuncHandlerInterface> handler; //处理类


        private static final Map lookup = new HashMap();
        static {
            for (FuncIdentify.FUNC_TYPE e : EnumSet.allOf(FuncIdentify.FUNC_TYPE.class)) {
                lookup.put(e.code, e);
            }
        }
        /**
         * 通code查找value
         * @param code
         * @return
         */
        public static FuncIdentify.FUNC_TYPE find(String code) {
            FuncIdentify.FUNC_TYPE value = (FuncIdentify.FUNC_TYPE) lookup.get(code);
            return value;
        }

        FUNC_TYPE(String code, Class<? extends FuncHandlerInterface> handler) {
            this.code = code;
            this.handler = handler;
        }

        public String getCode() {
            return code;
        }

        public Class<? extends FuncHandlerInterface> getHandler() {
            return handler;
        }
    }

}
